import java.util.*;

public class BinInsert {
    public static int binInsert(int n, int m, int j, int i) {
        // write code here
        int k = j;
        while (k <= i) {
            if (m % 2 != 0) {
                n += Math.pow(2, k);
            }
            m /= 2;
            k++;
        }
        return n;
    }

    public static void main(String[] args) {
        System.out.println(binInsert(1024, 19, 2, 6));

    }
}